package org.zoomdev.zoom.dao.provider;

import org.zoomdev.zoom.dao.ConnectionDescriptor;
import org.zoomdev.zoom.dao.DataSourceProvider;
import org.zoomdev.zoom.dao.impl.RawDataSource;

import javax.sql.DataSource;

public class RawDataSourceProvider implements DataSourceProvider {

    private final RawDataSource dataSource;

    public RawDataSourceProvider(ConnectionDescriptor connectionDescriptor) {
        this.dataSource = new RawDataSource(connectionDescriptor.getJdbcUrl(), connectionDescriptor.getUser(), connectionDescriptor.getPassword());
    }

    @Override
    public DataSource getDataSource() {
        return dataSource;
    }
}
